import { axios } from '@/utils/request'
import api from './index'

export function fetchAllGenConf (params) {
  return axios({
    url: `${ api.GenConf }/page`,
    method: 'get',
    params
  })
}

export function fetchPreview (params) {
  return axios({
    url: `${ api.GenConf }/preview`,
    method: 'get',
    params
  })
}

export function fetchCode (params) {
  return axios({
    url: `${ api.GenConf }/code`,
    method: 'post',
    params
  })
}

export function createGenConf (data) {
  return axios({
    url: `${ api.GenConf }/addGenConf`,
    method: 'post',
    data
  })
}

export function updateGenConf (id, data) {
  return axios({
    url: `${ api.GenConf }/updateGenConf/${id}`,
    method: 'put',
    data
  })
}

export function deleteGenConf (id) {
  return axios({
    url: `${ api.GenConf }/${id}`,
    method: 'delete'
  })
}
